﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Sequence
{
    /// <summary>
    /// Interaction logic for test.xaml
    /// </summary>
    public partial class test : Window
    {
        private Point _p;

        public test()
        {
            InitializeComponent();
        }

        private void Rectangle_MouseEnter(object sender, MouseEventArgs e)
        {
            Cursor = Cursors.Hand;
        }

        private void Rectangle_MouseLeave(object sender, MouseEventArgs e)
        {
            Cursor = Cursors.Arrow;
        }

        private void Rectangle_MouseDown(object sender, MouseButtonEventArgs e)
        {
            rect1.CaptureMouse();
            _p = e.GetPosition(rect1);
        }

        private void Rectangle_MouseUp(object sender, MouseButtonEventArgs e)
        {
            rect1.ReleaseMouseCapture();
        }

        private void Rectangle_MouseMove(object sender, MouseEventArgs e)
        {
            if (rect1.IsMouseCaptured)
            {
                Canvas.SetLeft(rect1, e.GetPosition(canvas1).X - _p.X);
                Canvas.SetTop(rect1, e.GetPosition(canvas1).Y - _p.Y);
            }
        }
    }
}
